#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
	int i = 0;
	int n = 10;
	int count_z = 0;
	int count_l = 0;
	int count_w = 0;
	char arr[10][20] = { 0 };

	for (i = 0; i < n; i++)
	{
		scanf("%s",&arr[i]);
	}

	for (i = 0; i < n; i++)
	{
		if (strcmp(arr[i] , "zhang") == 0 || strcmp(arr[i], "ZHANG") == 0 )
		{
			count_z++;
		}
		else if (strcmp(arr[i], "li") == 0 || strcmp(arr[i], "LI") == 0)
		{
			count_l++;
		}
		else if (strcmp(arr[i], "wang") == 0 || strcmp(arr[i], "WANG") == 0)
		{
			count_w++;
		}
	}

	printf("zhang\t%d\n", count_z);
	printf("li\t%d\n", count_l);
	printf("wang\t%d\n", count_w);

	return 0;
}